<!-- File: /app/View/Weibo/view.ctp -->

<h1><?php echo h($post['Weibo']['title']); ?></h1>
<hr/>
<p><?php echo h($post['Weibo']['content']) ?></p>
<hr/>

<?php
if ( $this->Session->read('userid') == $post['Weibo']['user_id'] )
{
echo $this->Html->link('Edit', array('action' => 'edit', $post['Weibo']['id']));
echo ' / ';
echo $this->Form->postLink(
	'Delete',
	array('action' => 'weiboDelete', $post['Weibo']['id']),
	array('confirm' => 'Are you sure?'));
}
?>


<p align="right" ><small>Created: <?php echo $post['Weibo']['date']; ?></small></p>

<table>
<?php foreach ( $comments as $comment ):  ?>
<tr>

<td>
<?php echo $this->Html->link($comment['User']['username'] ,
	array( 'controller' => 'users', 'action' => 'view', $comment['Comment']['user_id'] )); ?>
</td>

<td>
<?php echo $comment['Comment']['content']; ?>
</td>
<td>
<?php
if ( $this->Session->read('userid') == $comment['Comment']['user_id'] )
{
echo $this->Form->postLink(
	'Delete',
	array('action' => 'commentDelete', $comment['Comment']['id'] , $post['Weibo']['id']),
	array('confirm' => 'Are you sure?'));
}
?>
</td>
<td>
<?php echo $comment['Comment']['date']; ?>
</td>
</tr>
<?php endforeach; ?>
</table>

	<p>
<?php 
echo $this->Html->link( 'Add comment',
	array( 'action' => 'commentAdd' , $post['Weibo']['id']) );
echo '</p><p>';
echo $this->Html->link( 'Back' , array('controller' => 'weibos' , 'action' => 'index'));
?>
</p>
